<include file="../Public/header" />
<link href="{:APPS_URL}/w3g/_static/style.css" rel="stylesheet" type="text/css" />
<style type="text/css">
  body{background-color: #f8f8f8;}
</style>

<script type="text/javascript" src="__APP__/json2select.js"></script>
<script type="text/javascript" src="__APP__/group.info.form.js"></script>

<div id="content">
    <div id="weiba" data-title="创建群组" class="panel" data-selected="true"  data-menu="msgmenu">
        <header>
            <div id="header-buttons">
                <a href="javascript:history.go(-1);">
                    <div id="back" class="header-menu-link" data-back="false">
                    </div>
                </a>

                <div id="messageLink" class="header-menu-link"><a href="{:U('w3g/Index/msgbox')}"><i class="num"></i></a></div>
        <div id="menuLink" class="header-menu-link"></div>
            </div>
            <h1 class="hasback">
                创建群组
            </h1>
        </header>
  <div class="weibaPost">
    <form name="addform" id="groupAdd" action="{:U('w3g/Group/add')}" method="post" enctype="multipart/form-data">
      <div class="border">
        <dl class="formBox add_group">
          <dd>
            <input type="text" name="name" id="groupAdd_name" value="{$search_key}" class="text" placeholder="请输入群组名称"/>
          </dd>
          <dd>
            <div id="pid"></div>
          </dd>
          <dd>
            <div class="action clearfix" style="padding:0;">
              <div class="acts"><span style="display:inline-block;line-height:28px;">请上传群组banner</span>
              						    <a href="javascript:void(0);" class="image-block"><img height="28" class="icons" src="{:APPS_URL}/w3g/_static/images/ico_photo.png">
						    <input type="file" name="image" inputname='image' onchange="core.plugInit('uploadFile',this,'','image')" urlquery='attach_type=feed_image&upload_type=image&thumb=1&width=750&height=370&cut=1' hidefocus="true" limit=1>
						    </a><span class="f10">只能上传一张图片</span>
              </div>
              <div class="pb">
                <ul class="img_list" id="img_list">
                </ul>
              </div>
            </div>
          </dd>
          <dd>
            <div class="re_box">
              <textarea class="s-textarea" name="intro" id="groupAdd_intro" id="intro" placeholder="请输入群组简介"></textarea>
            </div>
          </dd>
          <dd>
            <div class="mb10">
              <label>
                <input type="radio" name="type" value="open" checked="checked" />
                公开<span class="cGray2">（群组内容公开，所有用户可见）</span></label>
            </div>
            <div>
              <label>
                <input type="radio" name="type" value="close" />
                私密<span class="cGray2">（群组内容私密，仅成员可见）</span></label>
            </div>
          </dd>
          <dd>
            <input name="verify" type="text" class="text" style="width:33%" id="verCode" placeholder="请输入验证码"/>
            <img src="__ROOT__/public/captcha.php" id="verifyimg" class="alM" onclick="group_info.change_verify()"/> <a href="###" onclick="group_info.change_verify()" alt="换一张">换一张</a> </dd>
        </dl>
      </div>
      <div class="form_btn"><a href="#" id="wait_submit" onClick="do_submit()" class="btn" style="width:100%;"><span>创建</span></a><a id="submiting" style="display:none" href="###" class="btn_gray" style="width:100%;"><span>创建中...</span></a></div>
    </form>

    <script type="text/javascript">

 $(document).ready(function(){
	 var category_json = {:getCategorySelect(0)};
	 $("#pid").json2select(category_json,'','cid');
 });
 

function do_submit(){
	var val = $('#groupAdd_name').val();
	if(val=='') {
		wap_error('群组名称不能为空');
		return false;
	}	
	
	var val = $("select[name='cid0'] option:selected").val();
	if(val=='') {
		wap_error('群组分类不能为空');
		return false;
	}	
		
	var val = $('#image_ids').val();

	if(val==''|| "undefined"==typeof(val)) {
		wap_error('群组banner不能为空');
		return false;
	}
	
	var check = group_info.check_form();
	if(!check) return false;
	
	$('#groupAdd').submit();
}
</script> 
  </div>
</div>
<include file="../Public/footer" /> 